<#assign className = table.className>   
<#assign classNameLower = className?uncap_first>   
package ${basepackage}.mapper;

<#include "./java_imports.include">
import org.springframework.stereotype.Repository;

@Repository
public class ${className}Mapper extends BaseMyBatisMapper<${className}, ${table.pkColumn.simpleJavaType}>{
	
	public Class<${className}> getEntityClass() {
		return ${className}.class;
	}

	@Override
	public int saveOrUpdate(${className} ${classNameLower}) {
		return ${classNameLower}.get${table.pkColumn.name}() == null ? insert(${classNameLower}) : update(${classNameLower});
	}

	@Override
	public Page<${className}> findByPageRequest(PageRequest pageRequest) {
		return pageQuery("${className}.paging", pageRequest);
	}
	
	<#list table.columns as column>
	<#if column.unique && !column.pk>
	public ${className} getBy${column.name}(${column.javaType} v) {
		return getSqlSession().selectOne("${className}.getBy${column.name}",v);
	}	
	</#if>
	</#list>
}